<script setup lang='ts'>
import { computed, ref } from 'vue';

// 计算属性注解 -- 自动根据依赖项数据进行推导
const count = ref(1)

const dbCount = computed(()=>{
  return count.value*2
})
console.log(dbCount.value)

// ref注解
type Item = {
  id: string,
  name: string,
  price: number,
}

let list = ref<Item[]>([])
list.value.push({
  id: '123',
  name: '男鞋',
  price: 123
})
let goods = computed(()=>{
  return list.value.filter(item=>item.price>50)
})
console.log(goods.value)


</script>
<template>
<div>
  hello vue
  <ul>
    <li v-for="item in goods" :key="item.id">
    {{ item.name }} -- {{ item.price }}元</li>
  </ul>
</div>
</template>
<style scoped>
</style>